package com.gdglc.spring.biz.impl.auth;

import java.util.Date;
import java.util.List;

import com.gdglc.spring.biz.auth.IRoleAuthorityBiz;
import com.y2.authprj.bean.auth.model.RoleauthorityInfo;
import com.y2.authprj.bean.auth.vo.ShowRoleByMulitTableVo;
import com.y2.authprj.dao.auth.IRoleAuthorityDao;

public class RoleAuthorityBizImpl implements IRoleAuthorityBiz {

	private IRoleAuthorityDao dao;
	
	public IRoleAuthorityDao getDao() {
		return dao;
	}

	public void setDao(IRoleAuthorityDao dao) {
		this.dao = dao;
	}

	@Override
	public List<RoleauthorityInfo> findAllRoleAuthority() {
		// TODO Auto-generated method stub
		return dao.findAllRoleAuthority();
	}

	@Override
	public int addRoleAuthority(RoleauthorityInfo roleauthorityInfo) {
		int i=dao.findRoleAuthorityTopOne();
		roleauthorityInfo.setRoleauthorityId(i+1);
		roleauthorityInfo.setCreatetTime(new Date());
		roleauthorityInfo.setDeleteFlag(1);
		// TODO Auto-generated method stub
		return dao.addRoleAuthority(roleauthorityInfo);
	}

	@Override
	public int updateRoleAuthority(RoleauthorityInfo roleauthorityInfo) {
		// TODO Auto-generated method stub
		roleauthorityInfo.setCreatetTime(new Date());
		roleauthorityInfo.setDeleteFlag(1);
		return dao.updateRoleAuthority(roleauthorityInfo);
	}

	@Override
	public int deleteRoleAuthority(int RoleAuthorityId) {
		// TODO Auto-generated method stub
		return dao.deleteRoleAuthority(RoleAuthorityId);
	}

	@Override
	public List<ShowRoleByMulitTableVo> findRoleAuthorityByMultiTable() {
		// TODO Auto-generated method stub
		return dao.findRoleAuthorityByMultiTable();
	}
	
	@Override
	public int deleteRoleAuthorityByRoleId(int RoleId) {
		// TODO Auto-generated method stub
		return dao.deleteRoleAuthorityByRoleId(RoleId);
	}

	@Override
	public RoleauthorityInfo findRoleAuthorityByRoleIdAndFunId(int roleId, int funId) {
		// TODO Auto-generated method stub
		return dao.findRoleAuthorityByRoleIdAndFunId(roleId, funId);
	}

}
